﻿
Namespace LightSwitchApplication

    Public Class Customer

        Private Sub FullName_Compute(ByRef result As String)
            ' Set result to the desired field value
            result = Me.LastName + ", " + Me.FirstName
        End Sub

        Private Sub FullAddress_Compute(ByRef result As String)
            ' Set result to the desired field value
            result = Me.Address1 + " " + Me.Address2 + " " + Me.Suburb + ", " + Me.State + " " + Me.Postcode + " " + Me.Country
        End Sub

        Private Sub Address1_Validate(results As EntityValidationResultsBuilder)
            ' results.AddPropertyError("<Error-Message>")
            If Me.Address1 = "" Then
                results.AddPropertyResult("Address should not be empty.", ValidationSeverity.Warning)
            End If
        End Sub

        Private Sub Email_Validate(results As EntityValidationResultsBuilder)
            ' results.AddPropertyError("<Error-Message>")
            If Me.Email = "" Then
                results.AddPropertyResult("If you do not specify an email address then no notifications will go out when scheduling appointments.", ValidationSeverity.Warning)
            End If
        End Sub
    End Class

End Namespace
